package com.balakitbbs.controller;

import org.springframework.beans.factory.annotation.Autowired; 
import java.util.*;               
import org.springframework.stereotype.Controller;               
import org.springframework.web.bind.annotation.PathVariable;               
import org.springframework.web.bind.annotation.RequestMapping;               
import org.springframework.web.servlet.ModelAndView;               
import com.balakitbbs.page.Page;               
import com.balakitbbs.page.SearchPageUtil;               
import com.balakitbbs.service.Bala_userconfigService;
import com.balakitbbs.entity.Bala_userconfig;
   /**
    * bala_userconfig Controller类
    */ 
@Controller
public class Bala_userconfigController{
	@Autowired
	private Bala_userconfigService bala_userconfigservice;

//增加用户配置表
@RequestMapping("/page/{pageIndex}/{pageSize}/addBala_userconfig")
public String addBala_userconfig(Bala_userconfig bala_userconfig,@PathVariable Integer pageIndex,@PathVariable Integer pageSize){
	bala_userconfig.setCdate(new Date());
	bala_userconfig.setId(UUID.randomUUID().toString());
	bala_userconfigservice.addBala_userconfig(bala_userconfig);
	return "redirect:/page/"+pageIndex+"/"+pageSize+"/selectBala_userconfig.do";
}


//删除用户配置表
@RequestMapping("/page/{Id}/{pageIndex}/{pageSize}/delBala_userconfig")
public String delBala_userconfig(@PathVariable String Id,@PathVariable Integer pageIndex,@PathVariable Integer pageSize){
	bala_userconfigservice.delBala_userconfig(Id);
	return "redirect:/page/"+pageIndex+"/"+pageSize+"/selectBala_userconfig.do";
}


//修改用户配置表
@RequestMapping("/page/{pageIndex}/{pageSize}/updateBala_userconfig")
public String updateBala_userconfig(Bala_userconfig bala_userconfig,@PathVariable Integer pageIndex,@PathVariable Integer pageSize){
	bala_userconfig.setUdate(new Date());
	bala_userconfigservice.updateBala_userconfig(bala_userconfig);
	return "redirect:/page/"+pageIndex+"/"+pageSize+"/selectBala_userconfig.do";
}


//查询用户配置表
@RequestMapping("/page/{pageIndex}/{pageSize}/selectBala_userconfig")
public ModelAndView selectBala_userconfigs(Bala_userconfig bala_userconfig,@PathVariable Integer pageIndex,@PathVariable Integer pageSize){
	ModelAndView modelAndView = new ModelAndView();
	int selectBala_userconfigCount = bala_userconfigservice.selectBala_userconfigsByPOJOCount(bala_userconfig);
	Page page = new Page(pageIndex, pageSize, selectBala_userconfigCount);
	SearchPageUtil spu = new SearchPageUtil();
	spu.setPage(page);
	modelAndView.addObject("data", bala_userconfigservice.selectBala_userconfigsByPojoPage(spu, bala_userconfig));
	modelAndView.addObject("page", page);
	modelAndView.addObject("s", 1);
	modelAndView.addObject("po", new Bala_userconfig());
	modelAndView.setViewName("/WEB-INF/page/bala_userconfig.jsp");
	return modelAndView;
}

}

